#include "SuperYoop.h"

CSuperYoop::CSuperYoop()
{

}

CSuperYoop::~CSuperYoop()
{

}

stringc CSuperYoop::GetPackageName()
{
	return "SuperYoop";
}

stringc CSuperYoop::GetPackageDescription()
{
	return "This package is a very fun 2D game";
}

s32 CSuperYoop::PackageStart()
{
	Init();

    StateManager->AddStateHandler(this,STATE_SUPERYOOP_START_GAME);
}

s32 CSuperYoop::PackageEnd()
{
	return 0;
}

s32 CSuperYoop::PackageUpdate()
{
//	Loop();
	return 0;
}

u32 CSuperYoop::GetVer()
{
	return 0;
}

u32 CSuperYoop::GetSubVer()
{
	return 1;
}

u32 CSuperYoop::GetRev()
{
	return 1;
}

void CSuperYoop::Init()
{
	game = new CGame();
}

void CSuperYoop::Finish()
{
	DEALLOCATE(game);
}

s32 CSuperYoop::EnterState()
{
    switch (StateID)
    {
        case STATE_SUPERYOOP_START_GAME:
        {
        	StateManager->ChangeState(this,STATE_SUPERYOOP_PLAYING_GAME);
            StateManager->AddStateHandler(game,STATE_SUPERYOOP_GAME_LOADGAME);
        }
        break;
    }

	return 0;
}

s32 CSuperYoop::ExitState()
{
	return 0;
}

s32 CSuperYoop::Update()
{
	switch (StateID)
	{
		case STATE_SUPERYOOP_PLAYING_GAME:
		{
			if (game->IsEnded())
			{
				DEALLOCATE(game);
			}

			StateManager->ChangeState(this,STATE_SUPERYOOP_EXIT_GAME);
		}
		break;
	}

	return 0;
}
